//
//  TestPageController.m
//  DFKit
//
//  Created by rujia chen on 17/4/12.
//  Copyright © 2017年 chenrj90. All rights reserved.
//

#import "DFTestPageController.h"
#import "DFSinglePageController.h"

@interface DFTestPageController ()

@end

@implementation DFTestPageController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.headView.titleButtonSpacing = 40;
    self.headView.scrollBufferLength = 60;
    self.headView.titleColor = [UIColor redColor];
    self.headView.barTintColor = nil;
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
}

//- (BOOL)df_shouldHideNavigationBar {
//    return YES;
//}

- (UIStatusBarStyle)preferredStatusBarStyle{
    return UIStatusBarStyleLightContent;
}

- (NSMutableArray<UIViewController *> *)viewControllers {
    if (!super.viewControllers) {
        super.viewControllers = [[NSMutableArray alloc] init];
        for (NSInteger i = 0; i < 18; i++) {
            UIViewController *vc = [[UIViewController alloc] init];
            vc.view.backgroundColor = [UIColor df_randomColor];
            vc.title = DF_CONCAT_STRING(@"vc", @(i).stringValue);
            
            UIView *view = DFMakeViewWithBackgroundColor([UIColor df_randomColor]);
            [view df_setIntrinsicContentSizeBlock:^CGSize(UIView *view) {
                return CGSizeMake(200, 200);
            }];
            
            [vc.view addSubview:view];
            
            [view mas_makeConstraints:^(MASConstraintMaker *make) {
                make.top.equalTo(vc.mas_topLayoutGuideBottom);
                make.centerX.equalTo(vc.view);
            }];
            
            UIView *bottomView = DFMakeViewWithBackgroundColor([UIColor df_randomColor]);
            [vc.view addSubview:bottomView];
            [bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
                make.bottom.equalTo(vc.mas_bottomLayoutGuideTop);
                make.centerX.equalTo(vc.view);
            }];
            [bottomView df_setIntrinsicContentSizeBlock:^CGSize(UIView *view) {
                return CGSizeMake(200, 200);
            }];
            
            UILabel *label = DFMakeLabel(@(i).stringValue, [UIColor whiteColor], [UIFont systemFontOfSize:18]);
            [vc.view addSubview:label];
            [label mas_makeConstraints:^(MASConstraintMaker *make) {
                make.center.equalTo(vc.view);
            }];
            
            DFSinglePageController *v = [[DFSinglePageController alloc] init];
            v.title = DF_CONCAT_STRING(@"vc", @(i).stringValue);
            [v df_setTopLayoutGuideLength:800];
            [super.viewControllers addObject:v];
//            [super.viewControllers addObject:vc];
        }
    }
    
    return super.viewControllers;
}

@end
